/**
 * 动作信息表单
 * wangmei
 */
import React, { Component } from 'react';
import { Modal, Button, Form, Input, message, Select, Checkbox, Radio, Row, Col  } from 'antd';
import * as Request from '../../../Server/Upgrade';
import * as Const from '../../../common/const';
import qs from 'qs';
require('./detail.css');

const { TextArea } = Input;
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const Option = Select.Option;
const CheckboxGroup = Checkbox.Group;
const emptyHeight = 25;
const actionData = [
    {
        title: 'updatesetting',
        value: 'updatesetting',
        paramName: ['pushetag','infoidset','needadmin','querycount' ]
    }, {
        title: 'showmessage',
        value: 'showmessage',
        paramName: ['popupid','hideifautomode' ]
    }, {
        title: 'restart',
        value: 'restart',
        paramName: ['randomone' ]
    }, {
        title: 'collect',
        value: 'collect',
        paramName: ['collectid','isBigPatch','needadmin' ]
    }, {
        title: 'download',
        value: 'download',
        paramName: ['patchset' ]
    }, {
        title: 'execute',
        value: 'execute',
        paramName: ['patchset','path','args','needadmin', 'forceupdate', 'needspace', 'wait' ]
    }, {
        title: 'add',
        value: 'add',
        paramName: ['path','localdir','patchset','needadmin', 'forceupdate', 'needspace']
    }, {
        title: 'delete',
        value: 'delete',
        paramName: ['patchset','path','args','needadmin', 'forceupdate' ]
    }
];
const detailLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
    },
};

const smallItemLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 7 },
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 17 },
    },
};

const checkLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 24 },
        xl: 4,
        className: 'label-align'
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 24 },
        xl: 20
    },
};

const paramLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
    },
};

const radioLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
        xl: 12
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
        xl: 12
    },
};

const radioSpan = {
    sm: 24,
    xl: 12
}

class ActionsFrom extends Component {
    constructor(props) {
        super(props);
        this.state = {
            indexData: [],
            idMain: 'updatesetting'
        };
    }

    componentWillMount() {
        this.getIndexData();
    }

    //保存方法
    handleSubmit = (e) => {
        e.preventDefault();
        const { form, row, id, current, size } = this.props
        form.validateFieldsAndScroll((err, values) => {
            const ifstatusData = Array.isArray(values.ifstatus)?values.ifstatus.join(','):values.ifstatus;
            const paramName = actionData.filter(v=>v.value==values.idMain)[0].paramName;
            let paramInfo = '';
            if(row.id){
                paramInfo = values.params;
            }else{
                const ifupdatemodeData = values.ifupdatemode.length>0?"ifupdatemode="+values.ifupdatemode.join(','):"";
                const ifinfoData = values.ifinfo?"ifinfo="+values.ifinfo+';':"";
                const extraInfoData = values.extraInfo?'附加信息='+values.extraInfo+';':"";
                for(let i = 0; i < paramName.length; i++){
                    if(paramInfo==''){
                        paramInfo = values[paramName[i]]&&values[paramName[i]]!=''?paramName[i]+'='+values[paramName[i]]:"";
                    }else if(values[paramName[i]]){
                        paramInfo = paramInfo + ';' + paramName[i]+'='+ values[paramName[i]]
                    }
                }
                paramInfo = paramInfo==''?paramInfo:paramInfo+';'
                paramInfo = paramInfo+extraInfoData+ifinfoData+ifupdatemodeData;
                if(((paramInfo.split('=')).length-1)==1){
                    paramInfo = paramInfo.split(';')[0]
                }
            }

            let param = {
                idMain: values.idMain,
                index: values.index,
                ifstatus: ifstatusData,
                ifactions: values.ifactions,
                mergetoaction: values.mergetoaction,
                params: paramInfo,
                executeif: values.executeif,
                versionId: id,
                remark: values.remark
            };
            if (!err) {
                if (row.id == undefined) { //新增
                    const _param = qs.stringify(param);
                    Request.actionsSave(_param).then(res => {
                        if (res && res.code == Const.REQUEST_SUCCESS) {
                            this.props.showModelFunc({}, false);
                            this.props.getTableData({ page: current?current-1:0, size: size(), vId: id });
                            message.success('新增成功！', 1);
                        } else {
                            res && res.code !== Const.REQUEST_UNAUTHORIZED && message.error(res.msg, 2);
                        }
                    });
                } else {
                    param.id = row.id;
                    const _param = qs.stringify(param);
                    Request.actionsUpdate(_param).then(res => {
                        if (res && res.code == Const.REQUEST_SUCCESS) {
                            this.props.showModelFunc({}, false);
                            this.props.getTableData({ page: current?current-1:0, size: size(), vId: id });
                            message.success('修改成功！', 1);
                        } else {
                            res && res.code !== Const.REQUEST_UNAUTHORIZED && message.error(res.msg, 2);
                        }
                    });
                }
            }
        });
    }

    //校验idMain方法
    validateIndex = (rule, value, callback) => {
        const { row } = this.props;
        const reg = /^[0-9]*$/;
        if (row.id&&row.index==value) {
            callback();
            return;
        }
        if(!reg.test(value)){
            callback('请输入数值类型的索引信息！');
            return;
        }
        if (value == '' || value == undefined) {
            callback('请输入索引信息！');
            return;
        }
        if (value) {
            const params = { index: value, vId: this.props.id };
            Request.actionsValidator(qs.stringify(params)).then(res => {
                if (res && Const.REQUEST_SUCCESS == res.code && !res.data) {
                    callback('索引已存在,请重新输入!');
                    return ;
                } else {
                    callback();//注意:回调函数必须调用
                    return;
                }
            });
        } else {
            callback();
        }
    }

    //获取合并到动作
    getIndexData = () => {
        const { id } = this.props
        const param = {
            vId: id
        }
        const _param = qs.stringify(param);
        Request.actionsGetIndexDesc(_param).then(res => {
            if (res && res.code == Const.REQUEST_SUCCESS) {
                const data = res.data
                this.setState({
                    indexData: data,
                });
            } else {
                res && res.code !== Const.REQUEST_UNAUTHORIZED && message.error(res.msg);
            }
        });
    }

    //动作名称改变
    onChange = (value) =>{
        this.setState({
            idMain: value
        })
    }

    showParam = (key) => {
        const { row } = this.props;
        const { getFieldDecorator } = this.props.form;
        
        switch (key) {
            case 'updatesetting': return <div>
                <Row style={{ height: 49}}>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="pushetag"
                        >
                            {getFieldDecorator('pushetag')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="needadmin"
                        >
                            {getFieldDecorator('needadmin')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                </Row>
                <FormItem
                    {...paramLayout}
                    label="infoidset"
                >
                    {getFieldDecorator('infoidset')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="querycount"
                >
                    {getFieldDecorator('querycount')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'showmessage': return <div>
                <FormItem
                    {...smallItemLayout}
                    label="popupid"
                >
                    {getFieldDecorator('popupid')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...smallItemLayout}
                    label="hideifautomode"
                >
                    {getFieldDecorator('hideifautomode')(
                        <Select style={{ width: '100%' }}>
                            <Option value={''} style={{ height: emptyHeight}}></Option>
                            <Option value={'false'} >
                                false
                            </Option>
                            <Option value={'true'} >
                                true
                            </Option>
                        </Select>
                    )}
                </FormItem>
                <FormItem
                    {...smallItemLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'restart': return <div>
                <FormItem
                    {...detailLayout}
                    label="randomone"
                >
                    {getFieldDecorator('randomone')(
                        <Select style={{ width: '100%' }}>
                            <Option value={''} style={{ height: emptyHeight}}></Option>
                            <Option value={'false'} >
                                false
                            </Option>
                            <Option value={'true'} >
                                true
                            </Option>
                        </Select>
                    )}
                </FormItem>
                <FormItem
                    {...detailLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'collect': return <div>
                <Row style={{ height: 49}}>
                    <Col {...radioSpan}>
                        <FormItem
                            {...{
                                labelCol: {
                                    xs: { span: 24 },
                                    sm: { span: 6 },
                                    xl: 10
                                },
                                wrapperCol: {
                                    xs: { span: 24 },
                                    sm: { span: 18 },
                                    xl: 14
                                },
                            }}
                            label="isBigPatch"
                        >
                            {getFieldDecorator('isBigPatch')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'0'} >
                                        0
                                    </Option>
                                    <Option value={'1'} >
                                        1
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col {...radioSpan}>
                        <FormItem
                            {...{
                                labelCol: {
                                    xs: { span: 24 },
                                    sm: { span: 6 },
                                    xl: 10
                                },
                                wrapperCol: {
                                    xs: { span: 24 },
                                    sm: { span: 18 },
                                    xl: 14
                                },
                            }}
                            label="needadmin"
                        >
                            {getFieldDecorator('needadmin')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                </Row>
                <FormItem
                    {...{
                        labelCol: {
                            xs: { span: 24 },
                            sm: { span: 6 },
                            xl: 5
                        },
                        wrapperCol: {
                            xs: { span: 24 },
                            sm: { span: 18 },
                            xl: 19
                        },
                    }}
                    label="collectid"
                >
                    {getFieldDecorator('collectid')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...{
                        labelCol: {
                            xs: { span: 24 },
                            sm: { span: 6 },
                            xl: 5
                        },
                        wrapperCol: {
                            xs: { span: 24 },
                            sm: { span: 18 },
                            xl: 19
                        },
                    }}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'download': return <div>
                <FormItem
                    {...checkLayout}
                    label="patchset"
                >
                    {getFieldDecorator('patchset')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...checkLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'execute': return <div>
                <FormItem
                    {...paramLayout}
                    label="patchset"
                >
                    {getFieldDecorator('patchset')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="path"
                >
                    {getFieldDecorator('path')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="args"
                >
                    {getFieldDecorator('args')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <Row style={{ height: 49}}>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="needadmin"
                        >
                            {getFieldDecorator('needadmin')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="forceupdate"
                        >
                            {getFieldDecorator('forceupdate')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                </Row>
                <FormItem
                    {...paramLayout}
                    label="needspace"
                >
                    {getFieldDecorator('needspace')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="wait"
                >
                    {getFieldDecorator('wait')(
                        <Select style={{ width: '100%' }}>
                            <Option value={''} style={{ height: emptyHeight}}></Option>
                            <Option value={'false'} >
                                false
                            </Option>
                            <Option value={'true'} >
                                true
                            </Option>
                        </Select>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'add': return <div>
                <FormItem
                    {...paramLayout}
                    label="path"
                >
                    {getFieldDecorator('path')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="localdir"
                >
                    {getFieldDecorator('localdir')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="patchset"
                >
                    {getFieldDecorator('patchset')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <Row style={{ height: 49}}>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="needadmin"
                        >
                            {getFieldDecorator('needadmin')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col {...radioSpan}> 
                        <FormItem
                            {...radioLayout}
                            label="forceupdate"
                        >
                            {getFieldDecorator('forceupdate')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                </Row>
                <FormItem
                    {...paramLayout}
                    label="needspace"
                >
                    {getFieldDecorator('needspace')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
            case 'delete': return <div>
                <FormItem
                    {...paramLayout}
                    label="patchset"
                >
                    {getFieldDecorator('patchset')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="path"
                >
                    {getFieldDecorator('path')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <FormItem
                    {...paramLayout}
                    label="args"
                >
                    {getFieldDecorator('args')(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
                <Row style={{ height: 49}}>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="needadmin"
                        >
                            {getFieldDecorator('needadmin')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col {...radioSpan}>
                        <FormItem
                            {...radioLayout}
                            label="forceupdate"
                        >
                            {getFieldDecorator('forceupdate')(
                                <Select style={{ width: '100%' }}>
                                    <Option value={''} style={{ height: emptyHeight}}></Option>
                                    <Option value={'false'} >
                                        false
                                    </Option>
                                    <Option value={'true'} >
                                        true
                                    </Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                </Row>
                <FormItem
                    {...paramLayout}
                    label="附加信息"
                >
                    {getFieldDecorator('extraInfo', {
                        initialValue: row.extraInfo || '',
                    })(
                        <Input maxLength={255}/>
                    )}
                </FormItem>
            </div>;
        }

    }

    render() {
        const { showModelFunc, row } = this.props;
        const { getFieldDecorator } = this.props.form;
        const { indexData, idMain } = this.state;
        const indexOptions = indexData.map(d => <Option key={d.index}>{d.index}</Option>);
        const formItemLayout = {
            labelCol: {
                xs: { span: 24 },
                sm: { span: 6 },
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 14 },
            },
        };

        const options = [
            { label: 'selfmode', value: 'selfmode' },
            { label: 'diffmode', value: 'diffmode' },
            { label: 'bigmode', value: 'bigmode' },
            { label: 'normalmode', value: 'normalmode' },
            { label: 'noupdate', value: 'noupdate' },
            { label: 'filterfail', value: 'filterfail' },
            { label: 'unauthorized', value: 'unauthorized' },
            { label: 'closeupdatetip', value: 'closeupdatetip' },
            { label: 'busy', value: 'busy' },
            { label: 'redirectsvr', value: 'redirectsvr' },
        ];

        const options1 = [
            { label: 'manual', value: 'manual' },
            { label: 'auto', value: 'auto' },
            { label: 'halfauto', value: 'halfauto' },
            { label: 'halfoverride', value: 'halfoverride' },
            { label: 'closemode', value: 'closemode' },
            { label: 'manualoverride', value: 'manualoverride' }
        ];

        return (
            <Modal
                visible={true}
                width="50%"
                title={row.id ? "修改动作信息" : "新增动作信息"}
                footer={null}
                maskClosable={false}
                onCancel={() => showModelFunc({}, false)}
            >
                <Form onSubmit={this.handleSubmit} >
                    <FormItem
                        {...formItemLayout}
                        label="动作名称"
                    >
                        {getFieldDecorator('idMain', {
                            rules: [{
                                required: true,
                                message: '请选择动作名称！'
                            }],
                            initialValue: row.idMain || 'updatesetting',
                        })(
                            <Select style={{ width: '100%' }} disabled={row.id} onChange={this.onChange}>
                                {
                                    actionData.map((item, index) => {
                                        return <Option value={item.value} >
                                            {item.title}
                                        </Option>
                                    })
                                }
                            </Select>
                        )}
                    </FormItem>
                    <FormItem
                        {...formItemLayout}
                        label="索引"
                    >
                        {getFieldDecorator('index', {
                            rules: [{
                                required: true,
                                validator: this.validateIndex,
                            }],
                            initialValue: row.index || '',
                        })(
                            <Input maxLength={9} style={{ width: '100%'}} />
                        )}
                    </FormItem>
                    <FormItem
                        {...formItemLayout}
                        label="服务器判断条件"
                    >
                        <FormItem
                            {...checkLayout}
                            label="ifstatus"
                        >
                            {getFieldDecorator('ifstatus', {
                                initialValue: row.ifstatus?row.ifstatus.split(','):[],
                            })(
                                <CheckboxGroup style={{ width: '100%' }}>
                                    <Row>
                                        {options.map((item, idnex)=>{
                                            return <Col span={8}><Checkbox value={item.value}>{item.label}</Checkbox></Col>
                                        })}
                                    </Row>
                                </CheckboxGroup>
                            )}
                        </FormItem>
                        <FormItem
                            {...checkLayout}
                            label="ifactions"
                        >
                            {getFieldDecorator('ifactions', {
                                initialValue: row.ifactions || '',
                            })(
                                <Input maxLength={255}/>
                            )}
                        </FormItem>
                        {!row.id&&<FormItem
                            {...checkLayout}
                            label="ifinfo"
                        >
                            {getFieldDecorator('ifinfo', {
                                initialValue: row.ifinfo || '',
                            })(
                                <Input maxLength={255}/>
                            )}
                        </FormItem>}
                        {!row.id&&<FormItem
                            {...{
                                labelCol: {
                                    xs: { span: 24 },
                                    sm: { span: 24 },
                                    xl: 7,
                                    className: 'label-align'
                                },
                                wrapperCol: {
                                    xs: { span: 24 },
                                    sm: { span: 24 },
                                    xl: 17
                                }
                            }}
                            label="ifupdatemode"
                        >
                            {getFieldDecorator('ifupdatemode', {
                                initialValue: row.ifupdatemode?row.ifupdatemode.split(','):[],
                            })(
                                <CheckboxGroup style={{ width: '100%' }}>
                                    <Row>
                                        {options1.map((item, idnex)=>{
                                            return <Col span={12}><Checkbox value={item.value}>{item.label}</Checkbox></Col>
                                        })}
                                    </Row>
                                </CheckboxGroup>
                            )}
                        </FormItem>}
                    </FormItem>
                    <FormItem
                        {...formItemLayout}
                        label="合并到动作"
                    >
                        {getFieldDecorator('mergetoaction', {
                            initialValue: row.mergetoaction || '',
                        })(
                            <Select
                                showSearch
                                style={{ width: '100%' }}
                                optionFilterProp="children"
                                onSelect={this.getIndexData}
                                filterOption={true}
                            >
                                {indexOptions}
                            </Select>
                        )}
                    </FormItem>
                    {row.id ? <FormItem
                        {...formItemLayout}
                        label="转换参数"
                    >
                        {getFieldDecorator('params', {
                            initialValue: row.params || '',
                        })(
                            <TextArea rows={4} maxLength={1000}/>
                        )}
                    </FormItem> : <FormItem
                        {...formItemLayout}
                        label="转换参数"
                    >
                            {this.showParam(idMain)}
                        </FormItem>}
                    <FormItem
                        {...formItemLayout}
                        label="客户端判断条件"
                    >
                        {getFieldDecorator('executeif', {
                            initialValue: row.executeif || '',
                        })(
                            <Input maxLength={255}/>
                        )}
                    </FormItem>
                    <FormItem
                        {...formItemLayout}
                        label="备注"
                    >
                        {getFieldDecorator('remark', {
                            initialValue: row.remark || '',
                        })(
                            <Input maxLength={255}/>
                        )}
                    </FormItem>
                    <Row type="flex" style={{ textAlign: 'center'}}>
                        <Col span={24}>
                            <FormItem>
                                <Button type="primary" htmlType="submit" className="conform-button">保存</Button>
                                <Button type="primary" onClick={() => showModelFunc({}, false)}>返回</Button>
                            </FormItem>
                        </Col>
                    </Row>
                </Form>
            </Modal>
        )
    }
}

export default Form.create()(ActionsFrom)